<%@ page contentType="text/html;charset=UTF-8" language="java" session="true" %>
<%@ taglib uri="/WEB-INF/tld/tags.tld" prefix="t" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="style/main.css">
    <title>Admissions. Order</title>
</head>
<body>
<table class="tableBody">
<tr>
    <td colspan="3">
        <t:header/>
    </td>
</tr>
<tr>
<td style="vertical-align: top;text-align: left">
    <t:menu roleUser="${sessionScope.userRole}"/></td>
<td style="background: #2c6932; width: 2px"/>
<td style="width: 900px">
<form name="orderForm" action="controller" method="post">
<c:set var="order" value="${requestScope.order}"/>
<c:set var="entrantsData" value="${requestScope.entrantsData}"/>
<%--<c:set var="disabled" value="${(order.adopted && sessionScope.userRole eq 'USER')?'disabled':''}"/>--%>
<table style="margin: 5px">
<tr>
    <td colspan="2">
        Information Card entrant № ${order.id}
        <input name="orderId" type="hidden" value="${order.id}">
    </td>
</tr>
<tr>
    <td>Lastname</td>
    <td><input name="lastname" type="text" value="${order.lastname}"></td>
</tr>
<tr>
    <td>Firstname</td>
    <td><input name="firstname" type="text" value="${order.firstname}"></td>
</tr>
<tr>
    <td>Middlename</td>
    <td><input name="middlename" type="text" value="${order.middlename}"></td>
</tr>
<tr>
    <td>Birthday</td>
    <td><input name="birthday" type="text" value="${entrantsData.birthday}"></td>
</tr>
<tr>
    <td>Nationality</td>
    <td>
        <c:set var="selectNationalty" value="${entrantsData.nationality.name}"/>
        <select name="nationality">
            <c:forEach var="nat" items="${requestScope.nationalities}">
                <option value="${nat.id}" ${nat.name == selectNationalty ? 'selected' : ''}>${nat.name}</option>
            </c:forEach>
        </select></td>
</tr>
<tr>
    <td>Sex</td>
    <td>
        <c:set var="selectSex" value="${entrantsData.sex}"/>
        <select name="sex">
            <c:forEach var="sx" items="${requestScope.sexs}">
                <option value="${sx}" ${sx == selectSex ? 'selected' : ''}>${sx}</option>
            </c:forEach>
        </select></td>
</tr>
<tr>
    <td>familyStatus</td>
    <td>
        <c:set var="selectFamilyStatus" value="${entrantsData.familyStatus}"/>
        <select name="familyStatus">
            <c:forEach var="famStatus" items="${requestScope.familyStatues}">
                <option value="${famStatus}" ${famStatus == selectFamilyStatus ? 'selected' : ''}>${famStatus}</option>
            </c:forEach>
        </select></td>
</tr>
<tr>
    <td>Citizenship</td>
    <td>
        <c:set var="selectCitizenship" value="${entrantsData.citizenship.name}"/>
        <select name="citizenship">
            <c:forEach var="cit" items="${requestScope.citizenship}">
                <option value="${cit.id}" ${cit.name == selectCitizenship ? 'selected' : ''}>${cit.name}</option>
            </c:forEach>
        </select></td>
</tr>
<tr>
    <td>IIN</td>
    <td><input name="IIN" type="text" value="${entrantsData.IIN}"></td>
</tr>
<tr>
    <td colspan="2">An identification document</td>
</tr>
<tr>
    <td colspan="2">
        <c:set var="selectDocType" value="${entrantsData.documentType.name}"/>
        <select name="docType">
            <c:forEach var="doc" items="${requestScope.documentTypes}">
                <option value="${doc.id}" ${doc.name == selectDocType ? 'selected' : ''}>${doc.name}</option>
            </c:forEach>
        </select></td>
</tr>
<tr>
    <td>№</td>
    <td><input name="docNumber" type="text" value="${entrantsData.documentNumber}"></td>
</tr>
<tr>
    <td>issued by</td>
    <td>
        <c:set var="selectDepartment" value="${entrantsData.department.name}"/>
        <select name="depName">
            <c:forEach var="dep" items="${requestScope.departments}">
                <option value="${dep.id}" ${dep.name == selectDepartment ? 'selected' : ''}>${dep.name}</option>
            </c:forEach>
        </select></td>
</tr>
<tr>
    <td colspan="2">Addresses</td>
</tr>
<tr>
    <td>Birthplace</td>
    <td><input name="birthplace" type="text" value="${entrantsData.birthplace}"></td>
</tr>
<tr>
    <td>Place of registration</td>
    <td><input name="placeOfRegistration" type="text" value="${entrantsData.placeOfRegistration}"></td>
</tr>
<tr>
    <td>Residence</td>
    <td><input name="residence" type="text" value="${entrantsData.residence}"></td>
</tr>
<tr>
    <td colspan="2">Phones</td>
</tr>
<tr>
    <td><input name="phone1" type="text" value="${requestScope.phone1}"></td>
    <td><input name="phone2" type="text" value="${requestScope.phone2}"></td>
</tr>
<tr>
    <td>Work</td>
    <td><input name="workplace" type="text" value="${entrantsData.workPlace}"></td>
</tr>
<tr>
    <td colspan="2">Basic education</td>
</tr>
<tr>
    <td>Education type</td>
    <td>
        ${entrantsData.educationType.name}
        <input type="hidden" name="educationType" value="${entrantsData.educationType.id}">
    </td>
</tr>
<tr>
    <td>Education years</td>
    <td>
        <input name="yearBegin" type="text" value="${requestScope.yearBegin}">-<input name="yearEnd"
                                                                                      type="text"
                                                                                      value="${requestScope.yearEnd}">
    </td>
</tr>
<tr>
    <td>Education place</td>
    <td><input name="educationPlace" type="text" value="${entrantsData.educationPlace}"></td>
</tr>
<tr>
    <td>Diploma</td>
    <td><input name="diploma" type="text" value="${entrantsData.diploma}"></td>
</tr>
<tr>
    <td>Diploma date</td>
    <td><input name="diplomaDate" type="text" value="${entrantsData.diplomaDate}">
    </td>
</tr>
<tr>
    <td>Certificate</td>
    <td><input name="certificate" type="text" value="${entrantsData.certificate}"></td>
</tr>
<tr>
    <td colspan="2">Teaching program</td>
</tr>
<tr>
    <td>Specialty</td>
    <td>
        <c:set var="selectSpecialty" value="${order.specialty.code}"/>
        <select name="specialty">
            <c:forEach var="spec" items="${requestScope.specialties}">
                <option value="${spec.id}" ${spec.code == selectSpecialty ? 'selected' : ''}>${spec.code}-${spec.name}</option>
            </c:forEach>
        </select>
    </td>
</tr>
<tr>
    <td>Teaching form</td>
    <td><c:set var="selectTeachingForm" value="${order.teachingForm.form}"/>
        <select name="teachingForm">
            <c:forEach var="tf" items="${requestScope.teachingForms}">
                <option value="${tf.id}"
                    ${tf.form == selectTeachingForm ? 'selected' : ''}>${tf.form}</option>
            </c:forEach>
        </select>
    </td>
</tr>
<tr>
    <td>Teaching plan</td>
    <td><input name="teachingPlanId" type="hidden" value="${order.teachingPlan.id}">
        <input name="teachingPlan" type="text" value="${order.teachingPlan.planName}"></td>
</tr>
<tr>
    <td>Language</td>
    <td>
        <c:set var="selectLanguage" value="${order.language}"/>
        <select name="language">
            <c:forEach var="lang" items="${requestScope.languages}">
                <option value="${lang}"
                    ${lang == selectLanguage ? 'selected' : ''}>${lang}</option>
            </c:forEach>
        </select>
    </td>
</tr>
<tr>
    <td>Payment form</td>
    <td><c:set var="selectPaymentType" value="${order.paymentType}"/>
        <select name="payment">
            <c:forEach var="pay" items="${requestScope.paymentTypes}">
                <option value="${pay}"
                    ${pay == selectPaymentType ? 'selected' : ''}>${pay}</option>
            </c:forEach>
        </select></td>
</tr>
<tr>
    <td colspan="2">
        <input type="hidden" name="action" value="orderFourthStep">
        <input type="hidden" name="addOrUpdate" value="UPDATE">
        <input type="submit" value="Save" name="submit" style="width: 90px">
    </td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
    <td colspan="3">
        <t:footer/>
    </td>
</tr>

</table>
</body>
</html>